<include file="common:header"/>
<div id="header">
    <div class="header">
        <h1 class="tit">{$site_title}</h1>
        <!--<p class="goback">-->
        <!--<a class="return" href="javascript:history.go(-1);">返回</a>-->
        <!--</p>-->
        <!--<p class="more"><a class="share" href=""></a></p>-->
    </div>
</div>
<link rel="stylesheet" href="{:C('__STATIC__')}{$theme}/Static/{:C('css')}/xfjl.css" />
<div class="banx-a">
    <ul class="uls">
        <!--<li><a href="{:U('Agent/agent_upgrade' ,array('audit'=>'n'))}" <if condition="$ast eq 'n'">class="page_active"</if>>待审</a></li>-->
        <!--<li><a href="{:U('Agent/agent_upgrade' ,array('audit'=>'y'))}" <if condition="$ast eq 'y'">class="page_active"</if>>已审</a></li>-->
        <!--<li><a href="{:U('Agent/agent_upgrade' ,array('audit'=>'p'))}" <if condition="$ast eq 'p'">class="page_active"</if>>自己的申请</a></li>-->
        <input type="hidden" value="r" class="status">
        <li><a class="page_active" href="javascript:void(0);" onclick="switchul('r',this)">待审</a></li>
        <li><a class="" href="javascript:void(0);" onclick="switchul('p',this)">已审</a></li>
        <li><a class="" href="javascript:void(0);" onclick="switchul('m',this)">自己的申请</a></li>
    </ul>

    <div class="two">
        <ul class="gone ready">
            <notempty name="upgrades_ready">
                <volist name="upgrades_ready" id="ups_ready" >
                    <!--id-->
                    <a href="{:U('Agent/up_audit' ,array('id' => $ups_ready['up_id']))}">
                        <li>
                            <div class="lip">
                                <span class="lip-first">{:GetAgentNameById($ups_ready['agent_id'])}</span>
                                <span class="lip-second">原 - {:GetRankNameById($ups_ready['old_rank'])}</span>
                            </div>
                            <div class="lipb">
                                <if condition="$ups_ready['is_adopt'] eq 1">
                                    <span style="height:0.25rem;font-size:0.3rem;">已通过</span>
                                    <elseif condition="$ups_ready['is_adopt'] eq 0"/>
                                    <span style="height:0.25rem;font-size:0.3rem;">未审核</span>
                                    <elseif condition="$ups_ready['is_adopt'] eq 2"/>
                                    <span style="height:0.25rem;font-size:0.3rem;">不通过</span>
                                </if>
                                <span style="height:1rem;line-height:1rem;font-size:0.3rem;">升 - {:GetRankNameById($ups_ready['rank_id'])}</span>
                            </div>
                        </li>
                    </a>
                </volist>
                <else/>
                <div class="no_data">
                    <img src="{:C('__STATIC__')}{$theme}/Static/img/no_data.png" class="tip_img"/>
                    <p class="tip_txt">暂时没有相关信息</p>
                </div>
            </notempty>
        </ul>
        <ul class="gone past" style="display: none">
            <notempty name="upgrades_past">
                <volist name="upgrades_past" id="ups_past" >
                    <!--id-->
                    <a href="{:U('Agent/up_audit' ,array('id' => $ups_past['up_id']))}">
                        <li>
                            <div class="lip">
                                <span class="lip-first">{:GetAgentNameById($ups_past['agent_id'])}</span>
                                <span class="lip-second">原 - {:GetRankNameById($ups_past['old_rank'])}</span>
                            </div>
                            <div class="lipb">
                                <if condition="$ups_past['is_adopt'] eq 1">
                                    <span style="height:0.25rem;font-size:0.3rem;">已通过</span>
                                    <elseif condition="$ups_past['is_adopt'] eq 0"/>
                                    <span style="height:0.25rem;font-size:0.3rem;">未审核</span>
                                    <elseif condition="$ups_past['is_adopt'] eq 2"/>
                                    <span style="height:0.25rem;font-size:0.3rem;">不通过</span>
                                </if>
                                <span style="height:1rem;line-height:1rem;font-size:0.3rem;">升 - {:GetRankNameById($ups_past['rank_id'])}</span>
                            </div>
                        </li>
                    </a>
                </volist>
                <else/>
                <div class="no_data">
                    <img src="{:C('__STATIC__')}{$theme}/Static/img/no_data.png" class="tip_img"/>
                    <p class="tip_txt">暂时没有相关信息</p>
                </div>
            </notempty>
        </ul>
        <ul class="gone my" style="display: none">
            <notempty name="upgrades_my">
                <volist name="upgrades_my" id="ups_my" >
                    <!--id-->
                    <a href="{:U('Agent/up_audit' ,array('id' => $ups_my['up_id']))}">
                        <li>
                            <div class="lip">
                                <span class="lip-first">{:GetAgentNameById($ups_my['agent_id'])}</span>
                                <span class="lip-second">原 - {:GetRankNameById($ups_my['old_rank'])}</span>
                            </div>
                            <div class="lipb">
                                <if condition="$ups_my['is_adopt'] eq 1">
                                    <span style="height:0.25rem;font-size:0.3rem;">已通过</span>
                                    <elseif condition="$ups_my['is_adopt'] eq 0"/>
                                    <span style="height:0.25rem;font-size:0.3rem;">未审核</span>
                                    <elseif condition="$ups_my['is_adopt'] eq 2"/>
                                    <span style="height:0.25rem;font-size:0.3rem;">不通过</span>
                                </if>
                                <span style="height:1rem;line-height:1rem;font-size:0.3rem;">升 - {:GetRankNameById($ups_my['rank_id'])}</span>
                            </div>
                        </li>
                    </a>
                </volist>
                <else/>
                <div class="no_data">
                    <img src="{:C('__STATIC__')}{$theme}/Static/img/no_data.png" class="tip_img"/>
                    <p class="tip_txt">暂时没有相关信息</p>
                </div>
            </notempty>
        </ul>
    </div>
</div>
<div class="dropload-load" id="loading" style="display: none;"><span class="loading"></span>加载中...</div>
<include file="common:footer"/>
<script type="text/javascript">
//        $(window).scroll(
//        function() {
//            var scrollTop = $(this).scrollTop();
//            var scrollHeight = $(document).height();
//            var windowHeight = $(this).height();
//            if (scrollTop + windowHeight > scrollHeight - 40) {
//                ajax_sourch_submit();//调用加载更多
//            }
//        }
//    );

        /**
         * 继续加载猜您喜欢
         * */
        var before_request = 1; // 上一次请求是否已经有返回来, 有才可以进行下一次请求
        var page = 1;

        function ajax_sourch_submit() {
            if (before_request == 0)// 上一次请求没回来 不进行下一次请求
                return false;
            before_request = 0;
            page++;
            $.ajax({
                url: "{:U('Agent/get_more_audit')}",
                type: "post",
                data: {
                    params: "{$params}",
                    status: $('.status').val(),
                    page: page
                },
                beforeSend:function() {
                    $('#loading').show();
                },
                success: function (msg) {
                    if (msg != -1) {
                        if ($('.status').val() == "r") {
                            $('.ready').append(msg);
                        } else if ($('.status').val() == "p") {
                            $('.past').append(msg);
                        } else if ($('.status').val() == "m") {
                            $('.my').append(msg);
                        }
                        before_request = 1;
                    } else {
                        $('#loading').text('没有更多的数据！');
                    }
                }
            });
        }




    function switchul(i,obj) {
        $('#loading').hide();
        if (!($(obj).hasClass("page_active"))) {
            $(obj).addClass("page_active");
            $(obj).parent().siblings().find("a").removeClass("page_active");
        }
        if(i == "r") {
            $('.ready').show();
            $('.past').hide();
            $('.my').hide();
            $('.status').val("r");
        }else if(i == "p"){
            $('.ready').hide();
            $('.past').show();
            $('.my').hide();
            $('.status').val("p");
        }else{
            $('.ready').hide();
            $('.past').hide();
            $('.my').show();
            $('.status').val("m");
        }
    }

</script>
